package com.uniknow.app.oauth.qq;

import org.json.JSONObject;

import android.app.Activity;

import com.tencent.tauth.IUiListener;
import com.tencent.tauth.UiError;

public class BaseUiListener implements IUiListener{

	private Activity mActivity;
	
	public BaseUiListener(Activity activity) {
		mActivity = activity;
	}
	
	@Override
	public void onComplete(Object response) {
		doComplete((JSONObject)response);
	}

	protected void doComplete(JSONObject values) {
		
	}

	@Override
	public void onError(UiError e) {
		Util.toastMessage(mActivity, "onError: " + e.errorDetail);
		Util.dismissDialog();
	}
	
	public void onError(Exception e) {
		Util.toastMessage(mActivity, "onError: " + e.getMessage());
		Util.dismissDialog();
	}

	@Override
	public void onCancel() {
		Util.toastMessage(mActivity, "onCancel: ");
		Util.dismissDialog();
	}

}
